'use strict';
/**
 * @param {"recommend" | "latest" | "hot" | "free" | "local" | "follows" | "random" | "uncensored" | "selfie"} type 类型：推荐|最新|热门|免费|同城|关注|随机|无码|自拍
 */

const db = uniCloud.database()
const videos = db.collection('video')
const _ = db.command
const $ = db.command.aggregate

exports.main = async (event, context) => {
	const {type="latest", page=1, size=10} = event
	
	switch(type){
		case "latest":
			const {data} = await videos.skip((page-1)*size).limit(size).get()
			return data
	}
};
